# 使用者物件.
class User < ActiveRecord::Base
  
  # 驗證密碼.
  def self.authenticate(name, password)
    user = self.find_by_name(name)
    unless user.nil?
      if password != user.password
        user = nil
      end
    end
    user
  end
  
end
